#ifndef __AC2MSG_H
#define __AC2MSG_H

enum
{
    FUNCTION_TEMPERATURE_UPDATE =       0x01,
    FUNCTION_SET_TARGET_TEMPERATURE =   0x02,
    FUNCTION_SET_MODE =                 0x03,
//    FUNCTION_MODE_UPDATE =              0x04,
    FUNCTION_VENT_STATUS_UPDATE =       0x05,
    FUNCTION_REQUEST_VENT_STATUS =      0x06,
};

enum
{
    HUB_NODE = 0x00,
    FIRST_TEMP_NODE = 0x10,
};

enum
{
	AM_AC2_MSG = 240,
    AM_SERIAL_MSG = AM_AC2_MSG + 1,
    AM_RADIO_MSG = AM_AC2_MSG + 2
};

// This is the structure for the ac2 header
typedef nx_struct ac2_header
{
	nx_uint8_t source;
	nx_uint8_t destination;
    nx_uint8_t function;
} ac2_header_t;

// This must be the max size of any message
typedef nx_struct ac2_msg_buffer
{
    ac2_header_t header;
    nx_uint8_t byte1;
    nx_uint8_t byte2;
    nx_uint8_t byte3;
} ac2_msg_buffer_t;

// Message type = FUNCTION_TEMPERATURE_UPDATE
typedef nx_struct temp_update
{
    ac2_header_t header;
    nx_uint16_t reading;
    nx_uint8_t counter;
} temp_update_t;

// Message type = FUNCTION_SET_TARGET_TEMPERATURE
typedef nx_struct set_target_temp
{
    ac2_header_t header;
    nx_uint16_t rawTemp;
    nx_uint8_t unused1;
} set_target_temp_t;

// Message type = FUNCTION_SET_MODE | FUNCTION_MODE_UPDATE | FUNCTION_VENT_STATUS_UPDATE
typedef nx_struct state
{
    ac2_header_t header;
    nx_uint8_t ventState;
    nx_uint8_t mode;
    nx_uint8_t unused1;
} state_t;
#endif // __AC2MSG_H
